<template>
  <view >
	
	<uni-search-bar  placeholder="请输入要查询的食材" bgColor="#EEEEEE" @confirm="search" />

    <liu-goods-swiper :listTitle="listTitle" :goodsList="goodsList" :imgWidth="150" :imgHeight="150" @clickItem="chooseItem" ></liu-goods-swiper>
					
				

	
	

  </view>
</template>

<script>
export default {
		data() {
			return {
				searchValue: '123123',
				//列表标题
				listTitle: '即将过期',
				//列表数据
				goodsList: [{
						id: 1,
						name: '大甜梨',
						icon: '/static/logo.png'
						
					},{
						id: 2,
						name: '猕猴桃',
						icon: '/static/logo.png'
					},{
						id: 3,
						name: '樱桃',
						icon: '/static/logo.png'
					},{
						id: 4,
						name: '猕猴桃',
						icon: '/static/logo.png'
					},{
						id: 5,
						name: '樱桃',
						icon: '/static/logo.png'
					}
				]
			};
		},
		computed: {
		    goodsList() {
		      return this.goodsList.map(item => ({
		        ...item,
		        descr: `已放入冰箱${item.id}天` // Dynamically set descr based on the item's id
		      }));
		    }
		  },
		methods: {
			search(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'none'
				})
			},
			 chooseItem(item){
			            // 点击拿到整个当前点击的item 执行业务逻辑 
			}
		},
		onBackPress() {
			// #ifdef APP-PLUS
			plus.key.hideSoftKeybord();
			// #endif
		}
	}
</script>

<style scoped>


</style>